package com.sxfq.loansupermarket.backsystem.modular.sharesHolding.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.sxfq.loansupermarket.backsystem.core.util.StringUtil;
import com.sxfq.loansupermarket.backsystem.modular.qualityAssurance.dao.DentalImageDao;
import com.sxfq.loansupermarket.backsystem.modular.qualityAssurance.entity.QualityAssuranceInfo;
import com.sxfq.loansupermarket.backsystem.modular.sharesHolding.dao.ISharesArePeopleHoldingDao;
import com.sxfq.loansupermarket.backsystem.modular.sharesHolding.entity.SearchSharesArePeopleInfo;
import com.sxfq.loansupermarket.backsystem.modular.sharesHolding.entity.SharesArePeopleInfo;
import com.sxfq.loansupermarket.backsystem.modular.sharesHolding.service.SharesArePeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 质量管理Dao
 *
 * @author fengshuonan
 * @Date 2019-09-01 15:34:05
 */
@Service
public class SharesArePeopleServiceImpl implements SharesArePeopleService {
    @Autowired
    private ISharesArePeopleHoldingDao dao;


    @Override
    public List<SharesArePeopleInfo> getList(Page<SharesArePeopleInfo> page, SearchSharesArePeopleInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getBeginTime())) {
            params.put("beginTime", searchInfo.getBeginTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getPeopleName())) {
            params.put("peopleName", searchInfo.getPeopleName());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getQueryPages(page, params);
    }

    @Override
    public int getQueryPagesCount(Page<SharesArePeopleInfo> page, SearchSharesArePeopleInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getBeginTime())) {
            params.put("beginTime", searchInfo.getBeginTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getPeopleName())) {
            params.put("peopleName", searchInfo.getPeopleName());
        }
        return dao.getQueryPageCount(page, params);
    }
}
